package model.commands.commandable;

import java.util.List;
import model.Environment;
import model.SyntaxErrorException;
import model.commands.Command;


/**
 * Name:
 * SETHEADING degrees
 * SETH degrees
 * 
 * Description:
 * turns turtle to an absolute heading
 * returns number of degrees moved
 * 
 * @author JLongley
 * @author Erick Gonzalez
 */
public class SetHeadingCommand extends Command {

    @Override
    public int evaluate(Environment e) throws SyntaxErrorException {
        List<Command> myArguments = getArguments();
        int heading = myArguments.get(0).evaluate(e);
        e.invokeCommandableMethod(Environment.SET_HEADING, heading);
        return heading;
    }
}
